//package com.elink.enginerring.controller;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//
//import java.util.Map;
//
//import javax.validation.Valid;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.ModelAttribute;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.elink.enginerring.co.BaseCo;
//import com.elink.enginerring.common.Constant;
//import com.elink.enginerring.common.ErrorType;
//import com.elink.enginerring.service.CollectionService;
//import com.elink.enginerring.util.JSONUtil;
//import com.elink.enginerring.util.LocalUtil;
//
//@RestController
//@RequestMapping("/api/collection")
//@Api("论文收藏接口")
//public class CollectionController {
//	@Autowired
//	private CollectionService collectionService;
//
//	/**
//	 * 收藏
//	 * @param userId
//	 * @param thesisId
//	 * @return
//	 */
//	@RequestMapping(value="/update",method=RequestMethod.GET)
//	@ApiOperation(value="用户收藏论文",httpMethod="GET")
//	public Map<String, Object> update(@ApiParam(value = "论文id", required = true) @RequestParam("thesisId") String thesisId) {
//		@SuppressWarnings("unchecked")
//		Map<String,Object> userInfo  = (Map<String, Object>) LocalUtil.get();
//		if(userInfo != null && userInfo.containsKey("userId")){
//			if((int)userInfo.get("userType")==Constant.personUserType){//只有个人用户才能够收藏
//				String userId =  userInfo.get("userId").toString();
//				return collectionService.updateCollect(userId, thesisId);
//			}else{
//				return JSONUtil.getJSON(ErrorType.AUTHORITY_ERROR);
//			}
//		}
//		return JSONUtil.getJSON(ErrorType.AUTHORITY_ERROR); 
//	}
//	
//	/**
//	 * 我的收藏
//	 * @param count
//	 * @return
//	 */
//	@RequestMapping(value="/myCollect",method=RequestMethod.GET)
//	@ApiOperation(value="我的收藏论文")
//	public Map<String, Object> getMyCollect(@ModelAttribute @Valid BaseCo co) {
//		@SuppressWarnings("unchecked")
//		Map<String,Object> userInfo  = (Map<String, Object>) LocalUtil.get();
//		String userId =  userInfo.get("userId").toString();
//		return collectionService.getMyCollect(co,userId);
//	}
//}
